<?php
$controller = $this->uri->segment(1);

$is_menu_home_active = false;
$is_menu_paying_active = false;
$is_menu_shopping_active = false;
$is_menu_winners_active = false;
$is_menu_instruction_active = false;
if($controller){
	$action = $this->uri->segment(2);
	if(strpos($controller,'nap-xu')!== false){
		$is_menu_paying_active = true;
	} else if(strpos($controller,'mua-hang')!== false){
		$is_menu_shopping_active = true;
	} else if($controller=='nguoi-chien-thang'){
		$is_menu_winners_active = true;
	} else if($controller=='huong-dan'){
		$is_menu_instruction_active = true;
	} else {
		$is_menu_home_active = true;
	}
} else {
	$is_menu_home_active = true;
}


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Content-Language" content="vi"/>
<meta name="Description" content=""/>
<meta name="Keywords" content=""/>
<meta name="Robots" content="index,follow"/>
<link rel="icon" href="<?=PATH_URL?>static/e-auction/favicon.ico"/>
<link rel="shortcut icon" type="image/x-icon" href="<?=PATH_URL?>static/e-auction/favicon.ico"/>
<link rel="image_src" href="<?=PATH_URL?>static/e-auction/Images/Logo.gif" type="image/gif"/>
<script type="text/javascript" src="<?=PATH_URL?>static/e-auction/jQuery.js"></script>
<script type="text/javascript" src="<?=PATH_URL?>static/e-auction/jQuery.ui.js"></script>
<script type="text/javascript" src="<?=PATH_URL?>static/e-auction/jQuery.Plugins.pack.js"></script>

<script type="text/javascript" src="<?=PATH_URL?>static/js/jquery.form.js"></script>

<!-- <script type="text/javascript" src="<?=PATH_URL?>static/e-auction/Bidding.js"></script> 
<script type="text/javascript" src="<?=PATH_URL?>static/js/Bidding_mod.js"></script> -->
<!-- <link href="<?=PATH_URL?>static/js/jquery.countdown.1.6.1/jquery.countdown.css" type="text/css" rel="stylesheet" /> -->
<script type="text/javascript" src="<?=PATH_URL?>static/js/jquery.countdown.1.6.1/jquery.countdown.js"></script>
<script type="text/javascript" src="<?=PATH_URL?>static/js/jquery.countdown.1.6.1/jquery.countdown-vi.js"></script>

<link href="<?=PATH_URL?>static/e-auction/Common.css" type="text/css" rel="stylesheet"/>
<link href="<?=PATH_URL?>static/e-auction/Pages.css" type="text/css" rel="stylesheet"/>

<link href="<?=PATH_URL?>static/css/main.css" type="text/css" rel="stylesheet"/>

<script type="text/javascript" src="<?=PATH_URL?>static/js/jquery.validate.js"></script>
<script type="text/javascript" src="<?=PATH_URL?>static/js/jquery.validate.messages_vn.js"></script>
<style>
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
#login_form label.error {
	display:block;
}
</style>

<title>Đấu giá ngược</title>
<script type="text/javascript">
function do_login(){
	$('#login_form').submit();
	return false;
}
function focus_login(){
	$('#login_email').focus();
}

/*Begin: Post message*/
function init_listen() {
	if (window.addEventListener) {  // all browsers except IE before version 9
		window.addEventListener ("message", OnMessage, false);
	} else {
		if (window.attachEvent) {   // IE before version 9
			window.attachEvent("onmessage", OnMessage);
		}
	}
}
function OnMessage(e) {
    if (e.data == 'refresh') {
        location.reload();
    }
}
init_listen();
/*End: Post message*/

$(document).ready(function(){
	$("#login_form").validate({
		rules: {
			email: {
				required: true,
				email: true
			},
			password: {
				required: true
			}
		}
	});
});
</script>
</head>

<body>
<div id="headerContainer">
    <div id="header">
		<a href="<?=PATH_URL?>" id="logo" ><img src="<?=PATH_URL?>static/e-auction/Logo.png" ></a>
		
		<!-- BEGIN: ACCOUNT SECTION -->
		<?php
		if(!empty($_SESSION['user'])){
			$user = $_SESSION['user'];
		?>
		<div class='user_panel'>
			<label class="low">Xin chào:<?=$user['email']?></label>
			<a href="<?=PATH_URL?>home/logout">Thoát</a>
			<br/>
			<label class="low">Tổng số xu hiện tại: <strong><?=$user['coin_number']?> xu</strong></label>
		</div>
		<?php
		} else {
		?>
		<div id="identification" class="visitor">
			<!-- Begin: Register with Social -->
			<div id="identificationButtons">
				<div id="headerSignUpButton"><a href="<?=PATH_URL?>dang-ky"><img src="<?=PATH_URL?>static/e-auction/SignUpButton.png"></a></div>
				<div id="headerFacebookConnectButton"> 
					<a href="Javascript:void(0);" onclick="return window.open('<?=url_login_openid('fb')?>','mywindow','menubar=0,resizable=1,width=500,height=300');">
						<div class="low small">Đăng ký / Đăng nhập trong 1 click!</div>
						<img src="<?=PATH_URL?>static/e-auction/FacebookConnectButton.png" > 
					</a>
				</div>
			</div>
			<!-- End: Register with Social -->
		
		
			<!-- Begin: Login form -->
			<div id="identificationForm">
			<form id="login_form" action="<?=PATH_URL?>home/login" method="post">
				<div id="headerLogInButton"><a href="javascript:focus_login()" ><img src="<?=PATH_URL?>static/e-auction/LogInButton.png" ></a></div>
				<div>
					<div id="identificationEmail">
						<label class="low">Địa chỉ e-mail :</label>
						<br>
						<div class="inputContainer">
						<input name="email" type="text" id="login_email" tabindex="1" class="inputText empty inputWithContainer">
						</div>
					</div>
					<div id="identificationPassword">
						<label class="low">Mật khẩu :</label>
						<br>
						<div class="inputContainer">
						<input name="password" type="password" id="login_password" tabindex="2" class="inputText empty inputWithContainer">
						</div>
					</div>
					<div id="identificationButton">
						<label class="low">&nbsp;</label>
						<br>
						<input type="image" name="" id="" tabindex="3" class="inputImage" src="<?=PATH_URL?>static/e-auction/OKButton.png"  style="border-width:0px;">
					</div>
					<div id="identificationRemember"> <a href="#" class="fakeInputCheckbox fakeInputCheckboxOn"> <span class="inputCheckbox">
						<input id="ctl00_IdentificationRemember" type="checkbox" name="" checked="checked" class="displayNone">
						<label for="ctl00_IdentificationRemember">Ghi nhớ tài khoản</label>
						</span> </a>
					</div>
					<div id="identificationForgot"> <a href="<?=PATH_URL?>home/password_recovery">Bạn quên mật khẩu?</a> / <a href="<?=PATH_URL?>dang-ky">Đăng ký</a> </div>
				</div>
			</form>
			</div>
			<!-- End: Login form -->
			
		</div>
		<?php
		}
		?>
	  <!-- END: ACCOUNT SECTION -->
	  
		<div class="clear"></div>
		
		<ul id="mainNav" class="designList designListHorizontal tabs">
			<li <?=$is_menu_home_active?'class="active"':''?>>
				<div class="cornerLeft"></div>
				<div class="navContent"><a href="<?=PATH_URL?>">Trang chủ</a></div>
				<div class="cornerRight"></div>
			</li>
			<?php
			if(!empty($_SESSION['user'])){
			?>
			<li <?=$is_menu_paying_active?'class="active"':''?>>
				<div class="cornerLeft"></div>
				<div class="navContent"><a href="<?=PATH_URL?>nap-xu">Nạp xu</a></div>
				<div class="cornerRight"></div>
			</li>
			<?php
			}
			?>
			<li <?=$is_menu_shopping_active?'class="active"':''?>>
				<div class="cornerLeft"></div>
				<div class="navContent"><a href="<?=PATH_URL?>mua-hang">Mua hàng</a></div>
				<div class="cornerRight"></div>
			</li>
			<li <?=$is_menu_winners_active?'class="active"':''?>>
				<div class="cornerLeft"></div>
				<div class="navContent"><a href="<?=PATH_URL?>nguoi-chien-thang">Người chiến thắng</a></div>
				<div class="cornerRight"></div>
			</li>
			<li <?=$is_menu_instruction_active?'class="active"':''?>>
				<div class="cornerLeft"></div>
				<div class="navContent"><a href="<?=PATH_URL?>huong-dan">Hướng dẫn</a></div>
				<div class="cornerRight"></div>
			</li>
		</ul>
    </div>
</div>
<div id="contentContainer">
	<div id="content">
		<!-- BEGIN: LEFT CONTENT -->
		<div id="contentCol">
			<?=$content?>
		</div>
		<!-- END: LEFT CONTENT -->
		
		<!-- BEGIN: RIGHT CONTENT -->
		<div id="rightCol">
			<?=modules::run('home/right_column')?>
		</div>
		 <!-- END: RIGHT CONTENT -->
	</div>
	<div class="clear"></div>
</div>
<div id="footerContainer">
	<div id="footer" style="color:#FFFFFF; padding-bottom:10px;">
		&copy; Copyright 2013
	</div>
</div>
</body>

</html>